﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Reflection;
using RLZY.others;
using Infragistics.Win.UltraWinGrid;
using System.Text.RegularExpressions;
namespace RLZY
{
    public partial class FormBDX_Modify : Form
    {
        public FormBDX_Modify()
        {
            InitializeComponent();
            
        }
        //public FormBDX_Modify(string username,String 权限)
        //{
        //    InitializeComponent();
        //    this.userID= strTextBox1Text;
        //}
        private static FormBDX_Modify childFromInstanc;
        static log4net.ILog LOG = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
        public String userID;
        public String 权限;

        
        public static FormBDX_Modify ChildFromInstanc
        {
            get
            {
                if (childFromInstanc == null || childFromInstanc.IsDisposed)
                //判断childFromInstanc是否有值，不为null或者窗体释放（当你将子窗体关了的时候）为childFromInstanc赋值
                {
                    childFromInstanc = new FormBDX_Modify();
                }
                return childFromInstanc;
                //返回的childFromInstanc（子窗体存在时返回的是null,关闭了（IsDisposed为true）或者第一次打开子窗体返回一个ChildForm实例）
            }
        }

        private void FormBDX_Modify_Load(object sender, EventArgs e)
        {
            try
            {
                BLL.userpassword bllpwd = new BLL.userpassword();
                Model.userpassword model = bllpwd.GetModel(Convert.ToInt32(others.UserHelper.UserID));
                others.myGZ mygz = new myGZ();
                mygz.setAll();
                权限 = model.备注;

                //DataSet ds = mygz.GetListPart(0, 权限);
                //this.BindData(ds);
                this.BindListInfo();
            }
            catch (Exception ex) { LOG.Error(ex); }
        }

        private void BindListInfo()
        {
            others.myGZ mygz = new myGZ();
            cmbBZ.Items.Clear();

            try
            {


                DataSet dsgz = mygz.GetListBM(权限);
                cmbBZ.DataSource = dsgz.Tables[0];
                cmbBZ.DisplayMember = "车间班组";  //列名1 
                cmbBZ.ValueMember = "车间班组";    //列名2 
                

            }
            catch (Exception ex)
            {
                LOG.Error(ex);
            }
        }

        private void BindData(DataSet ds)
        {
            DataView dv = new DataView();
            dv.Table = ds.Tables[0];
            //dv.Sort = "ID desc";//反排序
            //bindingSource1.DataSource = dv;
            this.ultraGrid1.DataSource = dv;
        }
        //列选择器
        private void btnCustomColumnChooser_Click(object sender, EventArgs e)
        {
            try
            {
                this.ShowCustomColumnChooserDialog();
            }
            catch (Exception ex) { LOG.Error(ex); }
        }
        private RLZY.CustomColumnChooser customColumnChooserDialog = null;
        
        private void ShowCustomColumnChooserDialog()
        {
            if (null == this.customColumnChooserDialog || this.customColumnChooserDialog.IsDisposed)
            {
                this.customColumnChooserDialog = new RLZY.CustomColumnChooser();
                this.customColumnChooserDialog.Owner = this;
                this.customColumnChooserDialog.Grid = this.ultraGrid1;
            }

            this.customColumnChooserDialog.Show();
        }
        //修改列布局
        private void btnDisplayLayout_Click(object sender, EventArgs e)
        {
            ultraGrid1.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.VisibleRows);
        }
        //隐藏列
        private void ultraGrid1_InitializeLayout(object sender, InitializeLayoutEventArgs e)
        {
            e.Layout.Bands[0].Columns[0].Hidden = true;
        }

        private void cmbBZ_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                BLL.userpassword bllpwd = new BLL.userpassword();
                Model.userpassword model = bllpwd.GetModel(Convert.ToInt32(others.UserHelper.UserID));
                others.myGZ mygz = new myGZ();
                权限 = model.备注;

                DataSet ds = mygz.GetListPartBZ(0, 权限,this.cmbBZ.Text.Trim());
                this.BindData(ds);
                
            }
            catch (Exception ex) { LOG.Error(ex); }
        }
        int id;

        private void ultraGrid1_DoubleClickCell(object sender, DoubleClickCellEventArgs e)
        {
            try
            {
                int i = this.ultraGrid1.ActiveRow.Index;
                id = Convert.ToInt32(this.ultraGrid1.Rows[i].Cells[0].Value.ToString().Trim());
                this.dtpDate.Text = this.ultraGrid1.Rows[i].Cells[1].Value.ToString().Trim();
                this.Dat = this.ultraGrid1.Rows[i].Cells[1].Value.ToString().Trim();
                this.txtName.Text = this.ultraGrid1.Rows[i].Cells[4].Value.ToString().Trim();

                this.cmbBZ.Text = this.ultraGrid1.Rows[i].Cells[3].Value.ToString().Trim();
                this.txtRB.Text = this.ultraGrid1.Rows[i].Cells[5].Value.ToString().Trim();
                this.txtZB.Text = this.ultraGrid1.Rows[i].Cells[6].Value.ToString().Trim();
                this.txtWB.Text = this.ultraGrid1.Rows[i].Cells[7].Value.ToString().Trim();
                this.txtDWB.Text = this.ultraGrid1.Rows[i].Cells[8].Value.ToString().Trim();
                this.txtJB.Text = this.ultraGrid1.Rows[i].Cells[10].Value.ToString().Trim();
                this.txtBF.Text = this.ultraGrid1.Rows[i].Cells[12].Value.ToString().Trim();
                this.txtSJ.Text = this.ultraGrid1.Rows[i].Cells[13].Value.ToString().Trim();
                this.txtBJ.Text = this.ultraGrid1.Rows[i].Cells[15].Value.ToString().Trim();
                this.txtGJ.Text = this.ultraGrid1.Rows[i].Cells[17].Value.ToString().Trim();
                this.txtGS.Text = this.ultraGrid1.Rows[i].Cells[18].Value.ToString().Trim();
                this.txtCJ.Text = this.ultraGrid1.Rows[i].Cells[19].Value.ToString().Trim();
                this.txtQTKK.Text = this.ultraGrid1.Rows[i].Cells[20].Value.ToString().Trim();
                this.txtJT4.Text = this.ultraGrid1.Rows[i].Cells[21].Value.ToString().Trim();
                this.txtJT5.Text = this.ultraGrid1.Rows[i].Cells[22].Value.ToString();
                this.txtKK5.Text = this.ultraGrid1.Rows[i].Cells[23].Value.ToString().Trim();
               
            }
            catch
            {
                //Common.RecordCommLog(ex);
                return;
            }

        }
        public void Last_Date()
        {
            others.myGZ mygz = new myGZ();
            DataSet dataSet = mygz.GetListLastDate(权限);
           
            bool flag = dataSet.Tables[0].Rows.Count > 0;
            if (flag)
            {
                this.LastDate = dataSet.Tables[0].Rows[0]["日期"].ToString();
            }
            else
            {
                this.LastDate = "9998-12-31";
            }
            
        }

        public string LastDate { get; set; }

        private void btnALLBZ_Click(object sender, EventArgs e)
        {
            try
            {
                

                this.Last_Date();
                DateTime time1 = DateTime.Parse(this.Dat);
                DateTime time2 = DateTime.Parse(this.LastDate);
                DateTime time3 = DateTime.Parse("2014-07-20");
                bool flag = DateTime.Compare(time1, time2) > 0 & DateTime.Compare(time1, time3) <= 0;
                if (flag)
                {
                    this.btnALLBZ.Enabled = false;
                    this.GZ_BZ_Modify();
                    Msg.DisplayMsg("提示", "全班组考勤成功。\r\n本提示窗口2秒钟后自动消失", 2000);
                    
                    BLL.userpassword bllpwd = new BLL.userpassword();
                    Model.userpassword model = bllpwd.GetModel(Convert.ToInt32(others.UserHelper.UserID));
                    others.myGZ mygz = new myGZ();
                    权限 = model.备注;

                    DataSet ds = mygz.GetListPartBZ(0, 权限, this.cmbBZ.Text.Trim());
                    this.BindData(ds);
                    this.ChangeNumer();
                    this.btnALLBZ.Enabled = true;
                }
                else
                {
                    MessageBox.Show("已做保护,不能输入修改");
                }
            }
            catch (Exception ex) { LOG.Error(ex); }
        }

        private void ChangeNumer()
        {
            try
            {
                string strErr = "";
                if (this.txtRB.Text.Trim().Length == 0)
                {
                    strErr += "日班不能为空！\r\n";
                }
                if (this.txtZB.Text.Trim().Length == 0)
                {
                    strErr += "中班不能为空！\r\n";
                }
                if (this.txtWB.Text.Trim().Length == 0)
                {
                    strErr += "晚班不能为空！\r\n";
                }
                if (this.txtDWB.Text.Trim().Length == 0)
                {
                    strErr += "大晚班不能为空！\r\n";
                }
                if (this.txtJB.Text.Trim().Length == 0)
                {
                    strErr += "加班不能为空！\r\n";
                }
                if (this.txtBF.Text.Trim().Length == 0)
                {
                    strErr += "补发不能为空！\r\n";
                }
                if (this.txtSJ.Text.Trim().Length == 0)
                {
                    strErr += "事假不能为空！\r\n";
                }
                if (this.txtBJ.Text.Trim().Length == 0)
                {
                    strErr += "病假不能为空！\r\n";
                }
                if (this.txtQTKK.Text.Trim().Length == 0)
                {
                    strErr += "其他扣款不能为空！\r\n";
                }
                if (this.txtGJ.Text.Trim().Length == 0)
                {
                    strErr += "公假不能为空！\r\n";
                }
                if (this.txtGS.Text.Trim().Length == 0)
                {
                    strErr += "工伤不能为空！\r\n";
                }
                if (this.txtCJ.Text.Trim().Length == 0)
                {
                    strErr += "产假不能为空！\r\n";
                }
                if (this.txtJT4.Text.Trim().Length == 0)
                {
                    strErr += "津贴4不能为空！\r\n";
                }
                if (this.txtJT5.Text.Trim().Length == 0)
                {
                    strErr += "津贴5(餐贴)不能为空！\r\n";
                }
                if (this.txtKK5.Text.Trim().Length == 0)
                {
                    strErr += "扣款5(餐贴)不能为空！\r\n";
                }

                if (strErr != "")
                {
                    MessageBox.Show(this, strErr);
                    return;
                }
           
            }
            catch (Exception ex)
            {
                LOG.Error(ex);
            }
        }

        private void GZ_BZ_Modify()
        {
            others.myGZ mygz = new myGZ();
            BLL.GZ bll = new BLL.GZ();

            this.ChangeNumer();
            int count = mygz.set0TONull();
            //if (count <= 0) { return; }
            
            foreach (UltraGridRow row in this.ultraGrid1.Rows)
            {
                int rowid = Convert.ToInt32(row.Cells["id"].ToString().Trim());
                update(bll,  rowid);

            }
                
            
        }
        private int GZ_BZ_ModifyOne()
        {
            others.myGZ mygz = new myGZ();
            BLL.GZ bll = new BLL.GZ();

            this.ChangeNumer();
            mygz.set0TONull();
            
            return update(bll, id);
            
        }
        private int update(BLL.GZ bll,  int id)
        {
            int count = 0;
            Model.GZ model = bll.GetModel(id);
            model.日班 = Convert.ToInt32(this.txtRB.Text);
            model.中班 = Convert.ToInt32(this.txtZB.Text);
            model.晚班 = Convert.ToInt32(this.txtWB.Text);
            model.大晚班 = Convert.ToInt32(this.txtDWB.Text);
            model.加班 = Convert.ToInt32(this.txtJB.Text);
            model.补发 = Convert.ToDecimal(this.txtBF.Text);
            model.事假 = Convert.ToInt32(this.txtSJ.Text);
            model.病假 = Convert.ToInt32(this.txtBJ.Text);
            model.公假 = Convert.ToInt32(this.txtGJ.Text);
            model.工伤 = Convert.ToInt32(this.txtGS.Text);
            model.产假 = Convert.ToInt32(this.txtCJ.Text);
            model.其它扣款 = Convert.ToDecimal(this.txtQTKK.Text);
            model.中晚班费 = Convert.ToDecimal(model.中班 * 6 + model.晚班 * 9 + model.大晚班 * 12);
            model.三项补贴 = model.粮贴 + model.洗理费 + model.水电气补贴;
            model.五项津贴 = model.津贴1 + model.津贴2 + model.津贴3 + model.津贴4 + model.津贴5;
            model.五项扣款 = model.扣款1 + model.扣款2 + model.扣款3 + model.扣款4 + model.扣款5;
            model.加班工资 = Convert.ToDecimal((model.技能工资 / 20.83) * model.加班);
            DateTime t1 = Convert.ToDateTime(model.参加工作时间);
            DateTime t2 = Convert.ToDateTime(model.日期);
            int age = t2.Year - t1.Year;
            if (t1.Month * 31 + t1.Day <= t2.Month * 31 + t2.Day)
            {
                age++;
            }
            if (age < 5) { model.扣病假工资 = Convert.ToDecimal((((model.技能工资 + model.绩效工资) * 0.3) / 20.83) * model.病假); }
            if (age >= 5 & age < 10) { model.扣病假工资 = Convert.ToDecimal((((model.技能工资 + model.绩效工资) * 0.25) / 20.83) * model.病假); }
            if (age >= 10 & age < 15) { model.扣病假工资 = Convert.ToDecimal((((model.技能工资 + model.绩效工资) * 0.20) / 20.83) * model.病假); }
            if (age >= 15 & age < 20) { model.扣病假工资 = Convert.ToDecimal((((model.技能工资 + model.绩效工资) * 0.15) / 20.83) * model.病假); }
            if (age >= 20 & age < 25) { model.扣病假工资 = Convert.ToDecimal((((model.技能工资 + model.绩效工资) * 0.10) / 20.83) * model.病假); }
            if (age >= 25 & age < 30) { model.扣病假工资 = Convert.ToDecimal((((model.技能工资 + model.绩效工资) * 0.05) / 20.83) * model.病假); }
            if (age >= 30) { model.扣病假工资 = 0; }
            model.扣事假工资 = Convert.ToDecimal(((model.技能工资 + model.绩效工资) / 20.83) * model.事假);
            model.行车工津贴 = Convert.ToInt32(model.行车工津贴 * (1 - (model.病假 + model.事假) * 0.2));

            if (model.行车工津贴 <= 0) { model.行车工津贴 = 0; }
            model.星级津贴 = Convert.ToInt32(model.星级津贴 * (1 - (model.病假 + model.事假) * 0.1));
            if (model.星级津贴 <= 0) { model.星级津贴 = 0; }
            
            
            model.应发总额 = model.技能工资 + model.岗位工资 + model.绩效工资 + model.粮贴 + model.回贴 + model.洗理费 + model.水电气补贴 + model.工龄津贴 + model.职称津贴 + model.特岗津贴 + model.行车工津贴 + model.卫生纸费 + model.车贴 + model.星级津贴 + model.津贴1 + model.津贴2 + model.津贴3 + model.津贴4 + model.津贴5 + model.补发 + model.中晚班费 + model.加班工资 - model.扣病假工资 - model.扣事假工资 - model.其它扣款;
            
            model.实发金额 = model.应发总额 - model.扣会费 - model.扣丧葬费 - model.扣互助金 - model.扣治安费 - model.扣电视费 - model.扣养老金 - model.扣失业保险 - model.扣医疗保险 - model.扣公积金 - model.扣款1 - model.扣款2 - model.扣款3 - model.扣款4 - model.扣款5;
            
            model.应发 = model.技能工资 + model.岗位工资 + model.绩效工资 + model.粮贴 + model.回贴 + model.洗理费 + model.水电气补贴 + model.工龄津贴 + model.职称津贴 + model.特岗津贴 + model.卫生纸费 + model.补发 + model.中晚班费 + model.加班工资 - model.扣病假工资 - model.扣事假工资 - model.其它扣款;
            
            model.实发 = model.应发 - model.扣会费 - model.扣丧葬费 - model.扣互助金 - model.扣治安费 - model.扣电视费 - model.扣养老金 - model.扣失业保险 - model.扣医疗保险 - model.扣公积金 - model.扣款5;
            if (model.部门单位 == "锻造厂" | (model.部门单位 == "特钢机关" & model.车间班组 == "驻外"))
            {
                model.应发总额 = model.技能工资 + model.岗位工资 + model.绩效工资 + model.粮贴 + model.回贴 + model.洗理费 + model.水电气补贴 + model.工龄津贴 + model.职称津贴 + model.特岗津贴 + model.行车工津贴 + model.卫生纸费 + model.车贴 + model.星级津贴 + model.津贴1 + model.津贴2 + model.津贴3 + model.津贴4 + model.津贴5 + model.补发 + model.中晚班费 + model.加班工资 - model.扣病假工资 - model.扣事假工资 - model.其它扣款;
                model.其它扣款 = model.其它扣款 + model.实发金额;
                model.实发金额 = model.应发总额 - model.扣会费 - model.扣丧葬费 - model.扣互助金 - model.扣治安费 - model.扣电视费 - model.扣养老金 - model.扣失业保险 - model.扣医疗保险 - model.扣公积金 - model.扣款1 - model.扣款2 - model.扣款3 - model.扣款4 - model.扣款5;
                model.应发 = model.应发总额;
                model.实发 = model.实发金额;
            }
            if (bll.Update(model)) { count++; };
            return count;
        }

        public string Dat { get; set; }

        private void txtRB_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar != 13 && e.KeyChar != 8 && !char.IsDigit(e.KeyChar) && e.KeyChar != 46) e.Handled = true;

            //int a = txtRB.Text.IndexOf('.');

            if (e.KeyChar == 46 ) e.Handled = true;
        }

        private void txtZB_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar != 13 && e.KeyChar != 8 && !char.IsDigit(e.KeyChar) && e.KeyChar != 46) e.Handled = true;

            //int a = txtZB.Text.IndexOf('.');

            if (e.KeyChar == 46 ) e.Handled = true;
        }

        private void txtWB_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar != 13 && e.KeyChar != 8 && !char.IsDigit(e.KeyChar) && e.KeyChar != 46) e.Handled = true;

            //int a = txtWB.Text.IndexOf('.');

            if (e.KeyChar == 46 ) e.Handled = true;
        }

        private void txtDWB_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar != 13 && e.KeyChar != 8 && !char.IsDigit(e.KeyChar) && e.KeyChar != 46) e.Handled = true;

            //int a = txtDWB.Text.IndexOf('.');

            if (e.KeyChar == 46) e.Handled = true;
        }

        private void txtJB_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar != 13 && e.KeyChar != 8 && !char.IsDigit(e.KeyChar) && e.KeyChar != 46) e.Handled = true;

            //int a = txtJB.Text.IndexOf('.');

            if (e.KeyChar == 46 ) e.Handled = true;
        }

        private void txtBF_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar != 13 && e.KeyChar != 8 && !char.IsDigit(e.KeyChar) && e.KeyChar != 46) e.Handled = true;

            int a = txtBF.Text.IndexOf('.');

            if (e.KeyChar == 46 && a > 0) e.Handled = true;
        }

        private void txtSJ_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar != 13 && e.KeyChar != 8 && !char.IsDigit(e.KeyChar) && e.KeyChar != 46) e.Handled = true;

            //int a = txtSJ.Text.IndexOf('.');

            if (e.KeyChar == 46 ) e.Handled = true;
        }

        private void txtBJ_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar != 13 && e.KeyChar != 8 && !char.IsDigit(e.KeyChar) && e.KeyChar != 46) e.Handled = true;

            //int a = txtBJ.Text.IndexOf('.');

            if (e.KeyChar == 46) e.Handled = true;
        }

        private void txtQTKK_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar != 13 && e.KeyChar != 8 && !char.IsDigit(e.KeyChar) && e.KeyChar != 46) e.Handled = true;

            int a = txtQTKK.Text.IndexOf('.');

            if (e.KeyChar == 46 && a > 0) e.Handled = true;
        }

        private void txtGJ_KeyPress(object sender, KeyPressEventArgs e)
        {

            if (e.KeyChar != 13 && e.KeyChar != 8 && !char.IsDigit(e.KeyChar) && e.KeyChar != 46) e.Handled = true;

            //int a = txtGJ.Text.IndexOf('.');

            if (e.KeyChar == 46) e.Handled = true;
        }

        private void txtGS_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar != 13 && e.KeyChar != 8 && !char.IsDigit(e.KeyChar) && e.KeyChar != 46) e.Handled = true;

            //int a = txtGS.Text.IndexOf('.');

            if (e.KeyChar == 46 ) e.Handled = true;
        }

        private void txtCJ_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar != 13 && e.KeyChar != 8 && !char.IsDigit(e.KeyChar) && e.KeyChar != 46) e.Handled = true;

            //int a = txtCJ.Text.IndexOf('.');

            if (e.KeyChar == 46) e.Handled = true;
        }

        private void txtJT4_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar != 13 && e.KeyChar != 8 && !char.IsDigit(e.KeyChar) && e.KeyChar != 46) e.Handled = true;

            int a = txtJT4.Text.IndexOf('.');

            if (e.KeyChar == 46 && a > 0) e.Handled = true;
        }

        private void txtJT5_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar != 13 && e.KeyChar != 8 && !char.IsDigit(e.KeyChar) && e.KeyChar != 46) e.Handled = true;

            int a = txtJT5.Text.IndexOf('.');

            if (e.KeyChar == 46 && a > 0) e.Handled = true;
        }

        private void txtKK5_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar != 13 && e.KeyChar != 8 && !char.IsDigit(e.KeyChar) && e.KeyChar != 46) e.Handled = true;

            int a = txtKK5.Text.IndexOf('.');

            if (e.KeyChar == 46 && a > 0) e.Handled = true;
        }
        //按回车键跳转

        protected override bool ProcessDialogKey(Keys keyData)
        {
            if (keyData == Keys.Enter && !(ActiveControl is Button))
            {//碰到Button时不跳转到下一个控件，而是执行Button的单击事件
                keyData = Keys.Tab;
            }
            return base.ProcessDialogKey(keyData);
        }

        private void btnOne_Click(object sender, EventArgs e)
        {
            try
            {

                this.Last_Date();
                DateTime time1 = DateTime.Parse(this.Dat);
                DateTime time2 = DateTime.Parse(this.LastDate);
                DateTime time3 = DateTime.Parse("2014-07-20");
                bool flag = DateTime.Compare(time1, time2) > 0 & DateTime.Compare(time1, time3) <= 0;
                if (flag)
                {
                    this.btnOne.Enabled = false;
                    if (GZ_BZ_ModifyOne() > 0)
                    {
                        Msg.DisplayMsg("提示", "单个考勤成功。\r\n本提示窗口2秒钟后自动消失", 1000);
                        BLL.userpassword bllpwd = new BLL.userpassword();
                        Model.userpassword model = bllpwd.GetModel(Convert.ToInt32(others.UserHelper.UserID));
                        others.myGZ mygz = new myGZ();
                        权限 = model.备注;

                        DataSet ds = mygz.GetListPartBZ(0, 权限, this.cmbBZ.Text.Trim());
                        this.BindData(ds);
                        this.ChangeNumer();
                        this.btnOne.Enabled = true;
                    }
                   

                }
                else
                {
                    MessageBox.Show("已做保护,不能输入修改");
                }
            }
            catch (Exception ex) { LOG.Error(ex); }
           
        }
    }
}
